#******************************************************************************
#
# Makefile - Rules for building the iSendIR application
#
# Jesper Hansen - 2010
#
# Initially based on the Sample Ethernet Application using lwIP 1.3.2.
#
# Copyright (c) 2007-2010 Texas Instruments Incorporated.  All rights reserved.
# Software License Agreement
# 
# Texas Instruments (TI) is supplying this software for use solely and
# exclusively on TI's microcontroller products. The software is owned by
# TI and/or its suppliers, and is protected under applicable copyright
# laws. You may not combine this software with "viral" open-source
# software in order to form a larger program.
# 
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
# DAMAGES, FOR ANY REASON WHATSOEVER.
# 
#
#******************************************************************************

#
# Defines the part type that this project uses.
#
PART=LM3S6965

#
# The base directory for StellarisWare.
#
ROOT=..

#
# Include the common make definitions.
#
include ${ROOT}/makedefs

#
# Where to find source files that do not live in this directory.
#
#VPATH=../drivers
VPATH+=$(ROOT)/third_party/lwip-1.3.2/apps/httpserver_raw
VPATH+=$(ROOT)/third_party/fatfs/port
VPATH+=$(ROOT)/third_party/fatfs/src
VPATH+=$(ROOT)/utils

#
# Where to find header files that do not live in the source directory.
#
IPATH=.
#IPATH+=..
IPATH+=$(ROOT)
IPATH+=$(ROOT)/third_party/lwip-1.3.2/apps
IPATH+=$(ROOT)/third_party/lwip-1.3.2/ports/stellaris/include
IPATH+=$(ROOT)/third_party/lwip-1.3.2/src/include
IPATH+=$(ROOT)/third_party/lwip-1.3.2/src/include/ipv4
IPATH+=$(ROOT)/third_party

#
# The default rule, which causes the Sample Ethernet Application using lwIP 1.3.2 to be built.
#
all: make_start
all: ${COMPILER}
all: ${COMPILER}/isendir.axf
all: make_end

makefs:
	@echo Creating Filesystem Started
	$(ROOT)/third_party/lwip-1.3.2/apps/httpserver_raw/makefsdata 
	@echo Creating Filesystem Complete

prog:
	@echo Programming Target
	../../../lmi_tools/eflash/eflash -i 192.168.1.126 --mac=00-1a-b6-00-06-d9  ${COMPILER}/isendir.bin
	@echo Programming Done
 
#
# The rule to clean out all the build products.
#
clean:
	@echo Cleaning Up
	@rm -rf ${COMPILER} ${wildcard *~}
	@echo Cleaning Complete

#
# The rule to create the target directory.
#
${COMPILER}:
	@mkdir ${COMPILER}

#
# Texts
#
make_start:
	@echo ----- Make Started -----

make_end:
	@echo ----- Make Ended -----

#
# Rules for building the Sample Ethernet Application using lwIP 1.3.2.
#
${COMPILER}/isendir.axf: ${COMPILER}/isendir.o
${COMPILER}/isendir.axf: ${COMPILER}/telnet.o
${COMPILER}/isendir.axf: ${COMPILER}/receiver.o
${COMPILER}/isendir.axf: ${COMPILER}/ir.o
${COMPILER}/isendir.axf: ${COMPILER}/timeout.o
${COMPILER}/isendir.axf: ${COMPILER}/cgissi.o
${COMPILER}/isendir.axf: ${COMPILER}/beacon.o
${COMPILER}/isendir.axf: ${COMPILER}/syscalls.o

${COMPILER}/isendir.axf: ${COMPILER}/cgifuncs.o
${COMPILER}/isendir.axf: ${COMPILER}/ff.o
${COMPILER}/isendir.axf: ${COMPILER}/httpd.o
${COMPILER}/isendir.axf: ${COMPILER}/lmi_fs.o
${COMPILER}/isendir.axf: ${COMPILER}/lwiplib.o
${COMPILER}/isendir.axf: ${COMPILER}/swupdate.o
${COMPILER}/isendir.axf: ${COMPILER}/mmc-isendir.o


${COMPILER}/isendir.axf: ${COMPILER}/startup_${COMPILER}.o
${COMPILER}/isendir.axf: ${COMPILER}/uartstdio.o
${COMPILER}/isendir.axf: ${COMPILER}/ustdlib.o
${COMPILER}/isendir.axf: ${COMPILER}/softeeprom.o
${COMPILER}/isendir.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a
${COMPILER}/isendir.axf: isendir.ld
SCATTERgcc_isendir=isendir.ld
ENTRY_isendir=ResetISR

#
# Include the automatically generated dependency files.
#
ifneq (${MAKECMDGOALS},clean)
-include ${wildcard ${COMPILER}/*.d} __dummy__
endif


